import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
    {
        path: '/',
        name: 'index',
        component: () => import("../views/shouye/index.vue")
    },
    {
        // 常见问题页面
        path: '/problem',
        name: 'problem',
        component: () => import("../views/instructions/problem.vue")
    },
    {
        // 服务介绍页面
        path: '/service',
        name: 'service',
        component: () => import("../views/instructions/service.vue")
    },
    //公司介绍页面
    {
        path: '/profile',
        name: 'company-profile',
        component: () => import("../views/profile/introduce.vue")
    },
    //个人中心页面
    {
        path: '/center',
        name: 'personal-center',
        component: () => import("../views/center/personal_center.vue")
    },
    //四个租车类型，企业租车
    {
        path: '/yj/enterprise',
        name: 'yjenterprise',
        component: () => import('../views/yj/enterprise.vue')
    },
    // 登录
    {
        path: '/login',
        name: 'login',
        component: () => import("../views/login/login.vue")
    },
    //接机送机
    {
        path: '/yj/aircraft',
        name: 'yjaircraft',
        component: () => import('../views/yj/aircraft.vue')
    },
    //个人租车
    {
        path: '/yj/personal',
        name: 'yjpersonal',
        component: () => import('../views/yj/personal.vue')
    },
    //婚庆租车
    {
        path: '/yj/wedding',
        name: 'yjwedding',
        component: () => import('../views/yj/wedding.vue')
    },

    //发布租车信息
    {
        path: '/releaseCar',
        name: 'releaseCar',
        component: () => import('../views/release/releaseCar.vue')
    },
    //发布新闻
    {
        path: '/newsRelease',
        name: 'newsRelease',
        component: () => import('../views/langxia/NewsRelease.vue')
    },

    //汽车详情页
    {
        path: '/yj/detail',
        name: 'yjdetail',
        component: () => import('../views/yj/detail.vue')
    },

    //汽车首页
    {
        path: '/Carshouye',
        name: 'Carshouye',
        component: () => import('../views/langxia/Carshouye.vue')
    },
    //留言
    {
        path: '/liuyan',
        name: 'liuyan',
        component: () => import('../components/liuyan.vue')
    },
	// 后台页面
	{
		path:'/backstage',
		name:'backstage',
		component:()=>import("../views/backstage/index.vue")
	},
	
    //新闻页面
    {
        path: '/yj/news',
        name: 'yjnews',
        component: () => import('../views/yj/news.vue'),
        redirect: '/yj/news/new',
        children: [ //配置子路由
            {
                path: '/yj/news/new', //子路由路径前边必须写父路由路径
                name: 'sonnew',
                component: () => import("../views/yj/component/news.vue")
            },
            {
                path: '/yj/news/industry', //子路由路径前边必须写父路由路径
                name: 'sonindustry',
                component: () => import("../views/yj/component/industry.vue")
            },
            {
                path: '/yj/news/detail', //子路由路径前边必须写父路由路径
                name: 'sondetail',
                component: () => import("../views/yj/component/detail.vue")
            }
        ]

    },

]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})
//全局后置守卫
router.afterEach((to, from) => {
    window.scrollTo(0, 0)
})
export default router